package com.rongshu.view.userInfo.presenter;

import android.content.Context;

import com.rongshu.api.RetorfitService;
import com.rongshu.view.base.mvp.BasePresenter;
import com.rongshu.view.userInfo.entity.Recommend;
import com.rongshu.view.userInfo.iview.RecommendView;

import rx.Subscriber;

public class RecommendPresenter extends BasePresenter<RecommendView> {

    public RecommendPresenter(Context context) {
        super(context);
    }

    /**
     * 我的推荐
     */
    public void getMyRecommend(int user_id, int page, int pagesize, String sign) {
        RetorfitService.getMyRecommend(user_id, page, pagesize, sign)
                .subscribe(new Subscriber<Recommend>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(Recommend recommend) {
                        if (getView() != null) {
                            getView().onMyRecommend(recommend);
                        }
                    }
                });
    }
}
